﻿<!doctype html>
<html>
<head>
    <title>微街秀 >上传截图</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap-fileinput-master/css/fileinput.min.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <style>
        #upimgs{width: 100%;height: 100%;}
        .btn-file{text-align: center;}
        .Centen{width: 50%;margin: 20px auto 25px auto;}
        .Uploadimg{width: 90%;margin: 20px auto 10px auto;text-align: center;height: 40px;line-height: 40px;border: #F37B0B 1px solid;border-radius: 5px;color: #F37B0B;font-size: 16px;}
        #ad_file{position: fixed;top: -100%;}
    </style>
</head>
<body>
    <form id="myform">
    <div class="wamtop">
        <div class="topleft" onclick="window.location.href='Makesh_1.html'">
            <img src="img/14.png" />
        </div>
        <div class="topcententxt">
            上传截图</div>
    </div>
    <div style="width: 50%; margin: 20px auto 25px auto; border: #EAEAEA 5px solid; border-radius: 5px;">
        <div>
            <div class="pt10" style="padding-top: 0px;">
                <input name="ad_file" id="ad_file" type="file" multiple="true">
            </div>
        </div>
        <div class="hifen">
        <a href="javascript:" onclick="go_wx()"><img src="img/Makeimg/23.png" style="width: 100%;" /></a>
  
            </div>
   
    </div>
        <div style="width: 90%;margin: 20px auto 0 auto; color: #8F8F8F;line-height: 22px;">
           此图为样本，参照此图进行截图；<br />
        </div>
    <div class="Uploadimg">
        上传</div>
   
    <div style="width: 90%;margin: 20px auto 0 auto; color: #8F8F8F;line-height: 22px;">
        <div>说明：</div>
        <div>1、分享到朋友圈之后<b style='color:Red'>30分钟</b>之内上传截图，否则红包自动失效；</div> 
        <div>2、如上传截图错误，可以在分享记录中打开此条广告分享记录，点击上传的截图重新上传；</div> 
        <div>3、上传的截图会人工审核，如发现截图不符，系统将自动冻结提现，分享主可以通过分享记录中此条广告记录去更新正确截图；</div> 
        <div>4、三次审核发现截图不符，系统自动锁定账户，分享主不能再使用微街秀；</div> 
        <div>5、分享主须对在微街秀注册信息的真实性、合法性、有效性承担全部责任；</div> 
        <div>6、微街秀有权对分享主使用微街秀的情况进行审查和监督，分享主不得弄虚作假或不当使用账户，一经发现，微街秀有权暂停或终止分享主使用微街秀的权利，以及没收微街秀账户的费用，且不作任何补偿；</div>
        <br />
    </div>
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/jquery-form.js" type="text/javascript"></script>
    <script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput_locale_zh.js" type="text/javascript"></script>
    <script src="js/jquery-submit.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script src="js/ajax-upload.js" type="text/javascript"></script>
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/base.js?25" type="text/javascript"></script>
    <script type="text/javascript">
        var logo = "";
        var id = "";
        var money_id="0"
        $(function () {
            id = getQueryString("id");
            money_id = getQueryString("money_id");
            //文章logo
            $("#ad_file").fileinput({
                showUpload: false,
                showCaption: false,
                showPreview: false,
                browseLabel: '',
                browseClass: "",
                browseIcon: '<img id="upimgs" src="" style="display:none" />',
                removeClass: 'hide',
                fileType: "any",
                allowedFileExtensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg']
            });

            var ua = navigator.userAgent.toLocaleLowerCase();
            if (ua.indexOf("wjx") != -1) {
                //客户端
                $("#ad_file").hide();
                $(".Uploadimg").on("click", function () {
                    var article_id = getQueryString("article_id");
                    //同一是否重复抢
                    if (article_id != null && (!checkHB(article_id))) {
                        Alert("一台手机不能重复抢");
                        return;
                    }
                    var param = { type: 1, cutType: 2, width: 640, callback: "addContentImg", url: "http://" + window.location.host + "/Client/Ajax/Upload.ashx?Img" };
                    var p = JSON.stringify(param);
                    window.location.href = "callback://imageUpload?" + p;
                });
            }
            else {
                //网页调用选择图片 
                $(".Uploadimg").click(function () {
                    $("#ad_file").click();
                });

                //选择了图片提交图片
                $("#ad_file").change(function () {
                    if ($(this).val().length == 0) {
                        toast.show("文件格式错误");
                        return;
                    }

                    wait.show();
                    var urlimg = "";
                    if ($("#ad_file").val().toLocaleUpperCase().indexOf(".GIF") > -1) {
                        urlimg = "/Client/Ajax/Upload.ashx?Img";
                    }
                    else {
                        urlimg = "/Client/Ajax/Upload.ashx?Img&is_cut=1&width=480&height=800";
                    }

                    if (money_id == null || money_id == '' || money_id < 1) {
                        Alert("红包参数加载失败");
                        return;
                    }

                    //上传图片
                    $("#myform").ajaxSubmit({
                        type: 'post',
                        dataType: "json",
                        url: urlimg,
                        success: function (data) {
                            wait.dismiss();
                            $("#ad_file").val("");
                            $("#upimgs").css("display", "block");
                            $(".hifen").css("display", "none");
                            $("#upimgs").attr("src", data.item);
                            logo = data.item;
                            Save(data.item);
                        },
                        error: function (XmlHttpRequest, textStatus, errorThrown) {
                            wait.dismiss();
                            $("#ad_file").val("");
                        }
                    });
                });
            }
        });

        function addContentImg(data) {
            $("#upimgs").css("display", "block");
            $(".hifen").css("display", "none");
            $("#upimgs").attr("src", data);
            Save(data);
        }

        function Save(picurl) {
            if (money_id == null || money_id == '' || money_id < 1) {
                Alert("红包参数加载失败");
                return;
            }
            AjaxStart("ajax/fc_shared.ashx?Shared", "id=" + id + "&money_id=" + money_id + "&picurl=" + picurl, function (data) {
                if (data.code == 0) {                    
                    if (getQueryString("article_id") != null)
                        SetHB(article_id);  //记录抢过的ID
                    Alert("截图上传成功");
                    setTimeout(function () { window.location.href = 'Makesh_2.html' }, 1000);
                }
                else
                    Alert(data.msg);
            });
        }
        function go_wx() {

            Alert("请手动打开微信朋友圈截图");
            setTimeout(function () { window.document.location.href = 'weixin://dl/moments/' }, 500);
        }
    </script>
    </form>
</body>
</html>
